package org.zachary.prosocialbehaviorservice.application.command;

import org.zachary.prosocialbehaviorservice.domain.aggregate_model.activity.Activity;

import java.util.List;

public record ActivityDTO(Integer id, String title, List<ActivityItemDTO> items) {
    public static ActivityDTO from(Activity activity) {
        List<ActivityItemDTO> itemDTOs = activity.getItems().stream()
                .map(ActivityItemDTO::from)
                .toList();
        return new ActivityDTO(activity.getId(), activity.getTitle(), itemDTOs);
    }
}